<?php

class Pagination
{
    function display($params) {
        $html = '<li><a href="#">'.$params['current_page'].'</a></li>';
        for ($i = 1; $i <= PER_PART/2; $i++){
            $next_page = $params['current_page'] + $i;
            if ($next_page < $params['total_page']) {
                $html .= '<li><a href="'.$params['file']."?page={$next_page}".'">'.$next_page.'</a></li>';
            }
            $prev_page = $params['current_page'] - $i;
            if ($prev_page  > 0) {
                $html = '<li><a href="'.$params['file']."?page={$prev_page}".'">'.$prev_page.'</a></li>'.$html;
            }
        }
        echo $html;
    }
}